package com.woniuxy.carrental.zqqmapper;

import com.woniuxy.carrental.entity.Emp;
import com.woniuxy.carrental.entity.RentCarInfo;
import com.woniuxy.carrental.entity.WarnRecord;
import com.woniuxy.carrental.mapper.RentCarInfoMapper;
import com.woniuxy.carrental.mapper.WarnRecordMapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Date;
import java.util.List;

/**
 * @author author
 * @create 2021-09-28 13:52
 */


@SpringBootTest
public class TsetWarnRecordMapper {

    @Autowired
    WarnRecordMapper warnRecordMapper;

    @Autowired
    RentCarInfoMapper rentCarInfoMapper;



    @Test
     public void testaddwarnRecord(){
        RentCarInfo rentCarInfo =new RentCarInfo();
        rentCarInfo.setRentcarid(1);
        WarnRecord warnRecord =new WarnRecord(null, 2,rentCarInfo, "车船损坏" , new Date(), false, 1,new Emp(),new Date(),new Date());
      warnRecordMapper.addWarnRecord(warnRecord);
     }


    @Test
    public void updatewarnRecord(){
       WarnRecord warnRecord=new WarnRecord(null, 4, new RentCarInfo(), "肖总砸坏", new Date(), false, 1, new Emp(),new Date(),new Date());
        warnRecordMapper.updatewarnRecord(warnRecord);
    }

    @Test
    public void selectwarnRecord(){
        WarnRecord warnRecord =new WarnRecord();
//        warnRecord.setWarnid(2);
        warnRecord.setWarn_cause("坏");
        List<WarnRecord> warnRecords = warnRecordMapper.selectAllwarnRecord(warnRecord, 1, 5);
        System.out.println(warnRecords);
    }


    @Test
    public void deletewarnRecord(){
        warnRecordMapper.delectwarnRecordByid(2);
    }


    @Test
    public void warnRecordcount(){
        int i = warnRecordMapper.selectwarnRecordCountBylimit(new WarnRecord());
        System.out.println(i);
    }


    @Test
    public void testupdate(){

        warnRecordMapper.updateStareBywarnid(1);
    }










}
